import request from '@/utils/request'

// datax插件api

//数据接收
export function getAcceptDataJson(data) {
  return request({
    url: '/system/dataextraction/dataExtractionMysql/acceptDataJsonMysql',
    method: 'post',
    data
  })
}

export function getList(params) {
  return request({
    url: '/system/data/dts/jobTemplate/pageList',
    method: 'get',
    params
  })
}

export function getExecutorList() {
  return request({
    url: '/system/data/dts/jobGroup/list',
    method: 'get'
  })
}

export function updateJob(data) {
  return request({
    url: '/system/data/dts/jobTemplate/update',
    method: 'post',
    data
  })
}

export function createJob(data) {
  return request({
    url: '/system/dataextractions/DataExtraction​/',
    method: 'post',
    data
  })
}

export function removeJob(id) {
  return request({
    url: '/system/data/dts/jobTemplate/remove/' + id,
    method: 'post'
  })
}

export function nextTriggerTime(cron) {
  return request({
    url: '/system/data/dts/jobTemplate/nextTriggerTime?cron=' + cron,
    method: 'get'
  })
}

export function getUsersList(params) {
  return request({
    url: '/system/data/dts/user/list',
    method: 'get',
    params
  })
}
// batchAdd
export function batchAddJob(data) {
    return request({
      url: '/system/dataextraction/DataExtraction/add',
      // headers:{"content-Type": "application/json;"},
      method: 'post',
      data
    })
  }
  export function bulidJson(data) {
    return request({
      url: '/system/dataextraction/DataExtraction/buildJson',
      method: 'post',
      data
    })
  }
  export function createDataExtractionMore(data) {
    return request({
      url: '/system/dataextraction/DataExtraction/batchAdd',
      method: 'post',
      data
    })
  }
  export function updateDataExtractionMore(data) {
    return request({
      url: '/system/dataextraction/DataExtraction/batchUpdate',
      method: 'post',
      data
    })
  }

export function addDataextractionJob(data) {
  return request({
    url: '/system/dataextraction/DataExtractionTask/add',
    method: 'post',
    data
  })
}
export function getDataextractionJobList(data) {
  return request({
    url: '/system/dataextraction/DataExtractionTask/list',
    method: 'post',
    data
  })
}
export function delDataextractionJob(ids) {
  return request({
    url: '/system/dataextraction/DataExtractionTask/delete',
    method: 'post',
    data: { ids }
  })
}
export function stopDataextractionJob(data) {
  return request({
    url: '/system/dataextraction/DataExtractionTask/changeJobStatus',
    method: 'post',
    data
  })
}

export function getDataextractionJobDetail(id) {
  return request({
    url: '/system/dataextraction/DataExtractionTask/detail/'+ id,
    method: 'get'
  })
}
